/*
 * @Autor: dingxiaolin
 * @Date: 2021-04-19 09:18:12
 * @LastEditors: dingxiaolin
 * @LastEditTime: 2021-05-17 09:07:06
 */
import { Delivery } from '@/http';
const state = () => ({
    modelList: [],
    pqList: [],
    stockList: [],
})
const getters = {
    modelList: (state) => state.modelList,
    pqList: (state) => state.pqList,
    stockList: (state) => state.stockList,
}
const mutations = {
    getmodelList(state, v) {
        state.modelList = v
    },
    getpqList(state, v) {
        state.pqList = v
    },
    getStockList(state, v) {
        state.stockList = v
    },
}
const actions = {
    /**获取机型列表 */
    async getjxList(ctx) {
        let data = await Delivery.GetModels()
        let modelList = ['全部'];
        data.forEach((item) => {
            modelList.push(item.arg1 as string);
        });
        ctx.commit('getmodelList', modelList)
    },
    /**获取片区数据 */
    async getPq(ctx) {
        let data = await Delivery.GetAreas()
        let pqList = ['全部'];
        data.forEach((item) => {
            pqList.push(item.arg1 as string);
        });
        ctx.commit('getpqList', pqList)
    },
    /**获取发货仓库*/
    async getStockList(ctx) {
        let data = await Delivery.GetStocks()
        let stockList = ['全部'];
        data.forEach((item) => {
            stockList.push(item.arg1 as string);
        });
        ctx.commit('getStockList', stockList)
    }
}
export default { state, getters, mutations, actions }